package cn.wolfcode.car.business.query;

import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Getter
@Setter
public class EmployeeQuery extends QueryObject {
    private String keyword;
    private Integer admin;
    private Integer status;
    private Long deptId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    public Date getEndTime() {
        if (this.endTime != null) {
            Calendar instance = Calendar.getInstance();
            instance.setTime(this.endTime);
            instance.add(Calendar.DATE, 1);
            instance.add(Calendar.SECOND, -1);
            return instance.getTime();
        }
        return null;
    }
}
